﻿<!DOCTYPE html>
<html>
<head>
	<title>Benchmark scope lookup</title>
</head>
<body>
	<script type="text/javascript">
		function bench_window_Math_round() {
			for (var i = 0; i < 10000; i++) {
				window.Math.round(1.23);
			}
		}

		function bench_Math_round() {
			for (var i = 0; i < 10000; i++) {
				Math.round(1.23);
			}
		}

		function bench_round() {
			for (var i = 0, round = Math.round; i < 10000; i++) {
				round(1.23);
			}
		}

		console.log('Profiling will begin in 3 seconds...');
		setTimeout(function () {
			console.profile();
			for (var i = 0; i < 10; i++) {
				bench_window_Math_round();
				bench_Math_round();
				bench_round();
			}
			console.profileEnd();
		}, 3000);
	</script>
</body>
</html>
